package com.hippomeetsskunk.savanna.types.resource;

import java.util.List;

import org.apache.log4j.Logger;

import com.hippomeetsskunk.savanna.types.meta.ResourceType;
import com.hippomeetsskunk.savanna.types.world.Location;

/**
 * need to override resourcesForImprovement, ... depending on state (crops, growing, harvesting, ...)
 * @author srzchx
 *
 */
public class Field extends LocatedResource {

	private static Logger logger = Logger.getLogger(Field.class);
	private RelocatableObject crops;
	
	public Field(Location location, double value, double quality){
		super(ResourceType.FIELD.toString(), ResourceType.FIELD, location, value, quality);
		this.crops = null;
	}
	
	public boolean isTilled(){
		return crops != null;
	}

	public void till(double work, List<RelocatableObject> resources) {
		for(RelocatableObject o : resources){
			if (ResourceType.SEED.equals(o.getType())){
				logger.debug("Tilling " + this + " with " + o);
				this.crops = o;
				return;
			}
		}
	}

}
